package com.cloudsigns.factorymanager2.project.presenter;

import com.cloudsigns.factorymanager2.project.iview.ISurveyFeedbackConfirmForManagerView;
import com.cloudsigns.factorymanager2.project.model.ISurveyFeedbackConfirmForManagerModel;
import com.cloudsigns.factorymanager2.project.model.SurveyFeedbackConfirmForManagerModel;

/**
 * Created by tony on 2018/8/5.
 */

public class SurveyFeedbackConfirmForManagerPresenter {
    private ISurveyFeedbackConfirmForManagerView view;
    private ISurveyFeedbackConfirmForManagerModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public SurveyFeedbackConfirmForManagerPresenter(ISurveyFeedbackConfirmForManagerView view) {
        this.view = view;
        this.model = new SurveyFeedbackConfirmForManagerModel();
    }

    public void surveyFeedbackConfirmForManager() {

        model.surveyFeedbackConfirmForManager(view.getcontent(),  view.getdailyFeedbackId(),view.getOrderId(),view.getItemId(),
              view.getType(),  new SurveyFeedbackConfirmForManagerModel.OnSurveyFeedbackConfirmForManagerListener() {
                    @Override
                    public void surveyFeedbackConfirmForManagerSunccessed() {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.surveyFeedbackConfirmForManagerSuccess();
                                view.hideLoading();
                            }
                        });
                    }

                    @Override
                    public void surveyFeedbackConfirmForManagerFailed(final String desc) {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.surveyFeedbackConfirmForManagerFailed(desc);
                                view.hideLoading();
                            }
                        });
                    }
                });
    }
}
